/**
 * Created by Ji.wenjiang on 2016/8/25.
 */
function ModalInstanceCtrl($scope, $modalInstance) {

  $scope.ok = function () {
    $modalInstance.close();
  };

  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };


};
angular.module('inspinia')
  .controller('modelController', function ($scope, users,SweetAlert,$modal) {
    init();
    function init() {
      if (localStorage.getItem('regObj')) {
        $scope.patientList = JSON.parse(localStorage.getItem('regObj'));
        $.each(users, function (i, val) {
          $scope.patientList.push(val);
        })
        $scope.persons = $scope.patientList;
        setTimeout(function () {
          $('#mainTable').trigger('footable_redraw');
        }, 100)
      } else {
        $scope.persons = [];
        $.each(users, function (i, val) {
          $scope.persons.push(val);
        })
        setTimeout(function () {
          $('#mainTable').trigger('footable_redraw');
        }, 100)
      }
    }
    $scope.confirmModel=function () {

      swal({
          title: "确认完成压模吗",
          text: "可在下方填写备注信息",
          type: "input",
          showCancelButton: true,
          closeOnConfirm: false,
          inputPlaceholder: "备注"
        },
        function(inputValue,isConfirm){

          if (inputValue === false) return false;

          else{
            if (inputValue === "") {
              swal("压模完成", "", "success");
            }else{
              swal("压模完成", "备注: " + inputValue, "success");
            }
          }


        });

    }
    $scope.openConfirm=function () {
      var modalInstance = $modal.open({
        templateUrl: 'app/makingModel/confirmModel.html',
        controller: ModalInstanceCtrl,
        windowClass: "animated fadeIn"
      });
    }

  })
  // .controller('translateCtrl',function ($translate, $scope) {
  // $scope.changeLanguage = function (langKey) {
  //   $translate.use(langKey);
  //   $scope.language = langKey;
  // };




